<template>
    <div class="todayContainer">
        <div class="content">
            <p class="title">早·有氧运动</p>
            <ul class="morning">
                <li v-for="sport in morningSports" :key="sport.id">
                    <div class="sports" :style="sport.isShow ? 'opacity:0.5' : 'opacity:1'">
                        <div class="sportImg" :style="{backgroundImage:'url('+backImg(sport)+')'}"></div>
                        <div class="sportName">
                            <p class="name" :style="sport.isShow ? 'text-decoration: line-through' : 'text-decoration: none'">{{ sport.name }}</p>
                        </div>
                        <div class="check" v-if="!sport.isShow" @click="sport.isShow=!sport.isShow"></div>
                        <div class="isCheck" v-if="sport.isShow" @click="sport.isShow=!sport.isShow"></div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="content">
            <p class="title">晚·无氧运动</p>
            <ul class="morning">
                <li v-for="sport in eveningSports" :key="sport.id">
                    <div class="sports" :style="sport.isShow ? 'opacity:0.5' : 'opacity:1'">
                        <div class="sportImg" :style="{backgroundImage:'url('+backImg(sport)+')'}"></div>
                        <div class="sportName">
                            <p class="name" :style="sport.isShow ? 'text-decoration: line-through' : 'text-decoration: none'">{{ sport.name }}</p>
                            <p class="course">课程跟练 ></p>
                        </div>
                        <div class="check" v-if="!sport.isShow" @click="sport.isShow=!sport.isShow"></div>
                        <div class="isCheck" v-if="sport.isShow" @click="sport.isShow=!sport.isShow"></div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</template>

<script>
    export default {
        name:'sportToday',
        data(){
            return{
                morningSports:[
                        {id:'1-24run',name:'慢跑20分钟',isShow:false},
                        {id:'1-25foot',name:'快走10分钟',isShow:false},
                ],
                eveningSports:[
                    {id:'1-22stretch',name:'拉伸运动20分钟',isShow:false},
                    {id:'1-23skip',name:'跳绳20分钟',isShow:false},
                ],
            }
        },
        computed:{
            backImg(){
                return (sport) =>{
                    return require(`../assets/img/1-icon@2x/${sport.id}icon.png`)
                }
            }
        }
    }
</script>

<style scoped>
    .todayContainer{
        width: 100%;
        padding-bottom: 2rem;
    }
    .content{
        margin-left: .32rem;
        margin-top: .4rem;
    }
    .title{
        font-size: .35rem;
        font-family: 'PingFangSC-Mediuem';
        color: #333333;
    }
    .morning{
        width: 6.86rem;
        margin-top: .4rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
    }
    .sports{
        background-color: #FFF;
        width: 6.86rem;
        height: 1.5rem;
        border-radius: .2rem;
        margin-bottom: .2rem;
        display: flex;
        align-items: center;
        transition: all 0.5s;
    }
    .sportImg{
        width: 1.2rem;
        height: 1.2rem;
        background-position: center;
        background-size: contain;
        margin-left: .15rem;
    }
    .sportName{
        font-size: .32rem;
        color:#333333;
        font-family: 'PingFangSC-Mediuem';
        display: flex;
        flex-direction: column;
        margin-left: .4rem;
    }
    .course{
        color:#6363637f;
        font-size: .24rem;
        font-family: 'PingFangSC-Regular';
        margin-top: .15rem;
    }
    .check{
        background-image: url(../assets/img/1-icon@2x/1-13check.png);
        width: 0.48rem;
        height: 0.48rem;
        background-position: center;
        background-size: contain;
        position: absolute;
        right: .1rem;
    }
    .isCheck{
        background-image: url(../assets/img/1-icon@2x/1-14isCheck.png);
        width: 0.48rem;
        height: 0.48rem;
        background-position: center;
        background-size: contain;
        position: absolute;
        right: .1rem;
    }
</style>